package cn.tpshion.config.common;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 时间工具类
 */
public class DateUtil {

    public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";

    public static final String YYYY_MM_DD_HH_MM_SS_sss = "yyyy-MM-dd HH:mm:ss.SSS";

    public static String stringToDate(long time){
        Date date = new Date(time);
        SimpleDateFormat sd = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        return sd.format(date);
    }

    public static String nowDate(){
        SimpleDateFormat sd = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS_sss);
        return sd.format(new Date());
    }
}
